#include "mainwindow.h"
#include "ui_mainwindow.h"

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    if(!m_lcm.good()){
        qDebug()<<"LCM init Err";
    }
}

MainWindow::~MainWindow()
{
    delete ui;
}

void MainWindow::on_btnSendMsg_clicked()
{
    exlcm::DataType myData;
    myData.timestamp = 0;
    myData.position[0] = 1.0;
    myData.position[1] = 2.0;
    myData.position[2] = 3.0;
    myData.orientation[0] = 3.14;
    myData.orientation[1] = 3.14*2;
    myData.orientation[2] = 3.14*3;
    myData.orientation[3] = 3.14*4;
    myData.num_ranges = 15;
    myData.ranges.resize(myData.num_ranges);
    for(int i=0; i<myData.num_ranges; i++){
        myData.ranges[i] = i;
    }
    myData.name = "example string";
    myData.enabled = true;

    m_lcm.publish("EXAMPLE", &myData);
}
